package com.water.component.nacos.config;

import com.water.wfo.component.util.SystemPropertiesUtil;
import org.apache.commons.collections.MapUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

/**
 * packageName com.water.component.nacos.config
 *
 * @author
 * @className WfoNacos(处以class为网)
 * @date 2025/3/13
 * @description T0D0
 */
@ConditionalOnMissingClass("com.water.component.nacos.config.WfoNacos")
@Configuration
@EnableDiscoveryClient
public class WfoNacos {

    @PostConstruct
    public void readNacosConfig() {
        if(MapUtils.isEmpty(SystemPropertiesUtil.getSystemProperties())){
            return;
        }
        NacosConfigLoader.readNacos(SystemPropertiesUtil.getSystemProperties(), new NacosListServiceImpl());
    }
}
